<template>
	<view class="content">
		<view class="mokuai" style="margin: 20rpx;padding: 20rpx;">
			<view class="info_title" style="position: relative;">
			   <view class="clear shenhe-text" style="padding-bottom: 50rpx;" >
					<text class="left">金额（元） </text>
					<text class="right black_font" >{{info.capital}}</text>
			   </view>
			</view>
			<view class="clear shenhe-text">
				<view class="left">
					<icon type="success" style="margin-top: 10px;" size="18"></icon>
				</view>
				<text class="left shenhe-part ma_top">提交审核</text>
				<text class="right" style="margin-top: 20rpx;">{{info.addtime}}</text>
			</view>
			<view class="process">
				
			</view>
			<!-- 一级审核———————————————————————— -->
			<view class="clear shenhe-text">
				<view class="left">
					<icon type="success"size="18" v-if="info.check_user!=0&&info.check_error_level!=1"></icon>
					<icon type="clear" color="#ff5a5a" size="18" v-if="info.check_error_level==1"></icon>
					<icon type="success"size="18" color="#cccccc" v-if="info.is_check==0"></icon>
				</view>
				<text class="left shenhe-part ma_top" v-if="info.check_user!=0&&info.check_error_level!=1" >业务经理审核已通过</text>
				<text class="left shenhe-part ma_top"  style="color: #ff5a5a;" v-if="info.check_error_level==1">业务经理审核已驳回</text>
				<text class="left shenhe-part ma_top"  style="color: #a1a1a1;" v-if="info.is_check==0">待业务经理审核</text>
				<text class="right" style="margin-top: 20rpx;">{{info.checktime1}}</text>
			</view>
			<view class="process" v-if="info.is_check==0" style="color: #a1a1a1;border-left:1px solid #a1a1a1 ;">
				
			</view>
			<view class="process" v-if="info.check_user!=0&&info.check_error_level!=1" style="color: #666666;">
				{{check_user_name}}
			</view>
			<view class="process"  style="color: #ff5a5a;border-left:1px solid #ff5a5a ;" v-if="info.check_error_level==1">
				{{info.error_reason}}
			</view>
			<!-- 二级审核———————————————————————— -->
			<view class="clear shenhe-text">
				<view class="left">
					<icon type="success" size="18"  v-if="info.is_check==2||info.is_check==3||info.check_error_level==3"></icon>
					<icon type="clear" color="#ff5a5a" size="18" v-if="info.check_error_level==2"></icon>
					<icon type="success" color="#cccccc" size="18"  v-if="info.is_check==0||(info.check_error_level==1&&info.is_check==-1&&info.check_error_level!=2)||info.is_check==1"></icon>
				</view>
				<text class="left shenhe-part ma_top" v-if="info.is_check==2||info.is_check==3||info.check_error_level==3">业务总监审核已通过</text>
				<text class="left shenhe-part ma_top"  style="color: #ff5a5a;" v-if="info.check_error_level==2">业务总监审核已驳回</text>
				<text class="left shenhe-part ma_top" style="color: #a1a1a1;"  v-if="info.is_check==0||(info.check_error_level==1&&info.is_check==-1&&info.check_error_level!=2)||info.is_check==1">待业务总监审核</text>
				<text class="right" style="margin-top: 20rpx;">{{info.checktime2}}</text>
			</view>
			<view class="process" v-if="info.is_check==0||(info.check_error_level==1&&info.is_check==-1&&info.check_error_level!=2)||info.is_check==1" style="color: #a1a1a1;border-left:1px solid #a1a1a1 ;">
				
			</view>
			<view class="process" style="color: #666666;" v-if="info.is_check==2||info.is_check==3||info.check_error_level==3">
				{{check_user2_name}}
			</view>
			<view class="process"  style="color: #ff5a5a;border-left:1px solid #ff5a5a ;" v-if="info.check_error_level==2">
				{{info.error_reason}}
			</view>
			<!-- 三级审核———————————————————————— -->
			<view class="clear shenhe-text">
				<view class="left">
					<icon type="success"  size="18" v-if="info.is_check==3"></icon>
					<icon type="clear" color="#ff5a5a" size="18" v-if="info.check_error_level==3"></icon>
					<icon type="success" color="#cccccc" size="18"  v-if="info.is_check!=3&&info.check_error_level!=3"></icon>
				</view>
				<text class="left shenhe-part ma_top"  v-if="info.is_check==3">银行审批已放款</text>
				<text class="left shenhe-part ma_top"  style="color: #ff5a5a;" v-if="info.is_check==-1&&info.check_error_level==3">银行审批已驳回</text>
				<!-- <text class="left shenhe-part ma_top" style="color: #a1a1a1;" v-if="((info.is_check<3||info.is_check!=-1)||!isbohui3)">待银行审批</text> -->
				<text class="left shenhe-part ma_top" style="color: #a1a1a1;"  v-if="info.is_check!=3&&info.check_error_level!=3">待银行审批</text>
				<text class="right" style="margin-top: 20rpx;">{{info.checktime3}}</text>
			</view>
			
			<view class="process"  style="border: none;color: #666666;" v-if="info.is_check==3">
				{{bank_user_name}}
			</view>
			<view class="process"  style="color: #ff5a5a;border: none;" v-if="info.check_error_level==3">
				{{info.error_reason}}
			</view>
			</view>
			<button class="big_button" style="margin: 100rpx auto;" @tap="goeditor()" v-if="show_btn">
				修改申请
			</button>
			<!-- <view class="clear shenhe-text">
				<view class="left">
					<icon type="clear" color="#ff0000" size="18"></icon>
					<!-- 审核驳回 -->
				<!-- </view>
				<text class="left shenhe-part ma_top"  style="color: #FF0000;">银行审批被驳回</text>
				<text class="right" style="margin-top: 20rpx;">2020-03-15 10:25</text>
			</view> -->
			<!-- <view class="process">
				
			</view> -->
		
		</view>
	</view>
</template>

<script>
	import httpPath from '@/static/js/path.js';
	import {getlogin} from '@/static/js/login.js';
	import {fmoney} from '@/static/js/login.js';
	import {timestampToDate} from '@/static/js/login.js';
	export default {
		data() {
			return {
				id:"",
				info:{},
				check_user_name:"",//一级审核人
				check_user2_name:"",//二级审核人
				bank_user_name:"",//二级审核人
				// btn_show:false,
				isbohui1:false,
				isbohui2:false,
				isbohui3:false,
				show_btn:false,
				
			}
		},
		onShow() {
			this.user = getlogin();
			if(!this.user.islogin){
				uni.showModal({
				   showCancel:false,
				   content:"您还没有登录，请登录"
				})
				uni.navigateTo({
					url:"../public/login"
				})
			}	
			// this.id = option.id;
			this.getinfo();
		},
		onLoad(option) {
			this.user = getlogin();
			if(!this.user.islogin){
				uni.showModal({
				   showCancel:false,
				   content:"您还没有登录，请登录"
				})
				uni.navigateTo({
					url:"../public/login"
				})
			}	
			this.id = option.id;
			this.getinfo();
		},
		methods: {
			goeditor(){
				uni.navigateTo({
					url:"goloan?id="+this.id
				})
			},
			getinfo(){
				uni.request({
					url: httpPath.filePath+"api.php/index/member/getLoanDetail/",
					method:'POST',
					header:{'content-type':'application/x-www-form-urlencoded'},
					data: {member_id:this.user.member_id,id:this.id},
					success: (res) => {
						if(res.data.code=="200"){
							this.info=res.data.result;
							this.info.capital=fmoney(this.info.capital)
							this.info.addtime=timestampToDate(this.info.addtime)
							if(this.info.checktime1!=""){
								this.info.checktime1=timestampToDate(this.info.checktime1)
							}
							if(this.info.checktime2!=""){
								 this.info.checktime2=timestampToDate(this.info.checktime2)
							}
							if(this.info.checktime3!=""){
								 this.info.checktime3=timestampToDate(this.info.checktime3)
							}
							
							
							if(this.info.check_user_name){
								this.check_user_name = "审核人:"+this.info.check_user_name
							}else{
								this.check_user_name = "待审核"
							}
							if(this.info.check_user2_name){
								this.check_user2_name = "审核人:"+this.info.check_user2_name
							}else{
								this.check_user2_name = "待审核"
							}
							if(this.info.bank_user_name){
								this.bank_user_name = "审核人:"+this.info.bank_user_name
							}else{
								this.bank_user_name = "待审核"
							}
							if(this.info.is_check==-1){
								this.show_btn=true;
							}

						}
						
					}
				});	
			},
			
	       //改变审核状态
		   changeindex(index){  
			   this.current=index;
			   console.log(this.current)
		   }
		   //点击跳转详情
		   ,goinfo(){
			   uni.navigateTo({
			   	url:"../myself/info"
			   })
		   }
		}
	}
</script>

<style>
	@import "../../colorui/main.css";
	page{background: #fff;}
	.ma_top{margin-top: 12px!important;}
</style>
